{% extends "basic.html" %}
{% block mainbody %}
{% load mytags %}
<style>
div.input-group{margin:5px;}
</style>
<table class="table table-striped">
  <thead>
    <tr>
      <th>ID</th>
      <th>金额</th>
      <th>名称</th>
    </tr>
  </thead>
  <tbody>
    {% for vo in list %}
    <tr>
      <td>{{ vo.id }}[<a href="/borrow/add/?id={{ vo.id }}">类</a>]</td>
      <td>{{ vo.borrow_money }}</td>
      <td><a href="/borrow/edit/?id={{ vo.id }}">{{ vo.borrow_name }}[{% if vo.is_immediately_loan == "1" %}立起息{% else %}普通{% endif %}]</a></td>
    </tr>
    {% endfor %}
  </tbody>
</table>
<nav>
  <ul class="pagination">
  {% if current_page.has_previous %}
    <li ><a href="?page={{ current_page.previous_page_number }}{{ more_param }}">上一页 <span class="sr-only">(current)</span></a></li>
  {% endif %}
  {% pagination current_page paginator 10 2 GET as page_list %}  <!-- 引用自定义标签，并传入参数 -->
  {{ page_list|safe }}  <!--  显示 -->
  {% if current_page.has_next %}
    <li><a href="?page={{ current_page.next_page_number }}{{ more_param }}">下一页 <span class="sr-only">(current)</span></a></li>
  {% endif %}
  </ul>
</nav>
<div id="search" class="text-center navbar-fixed-top" style="background:#e2e2e2;padding:5px;display:none;">
<form id="form1" class="form-horizontal" role="form" method="GET" action="/borrow/all/">
{% csrf_token %}
  <div class="input-group">
      <span class="input-group-addon">ID</span>
      <input type="number" class="form-control" name="id" value="{{ GET.id }}">
  </div>
  <div class="input-group">
      <span class="input-group-addon">名称</span>
      <input type="text" class="form-control" name="borrow_name" value="{{ GET.borrow_name }}">
  </div>
  <div class="input-group">
      <span class="input-group-addon">状态</span>
      <select class="form-control" name="borrow_status">
      <option value="" selected>全部</option>
      {% for vo in arr_borrow_status %}
        <option value="{{ vo.k }}" {% ckSelectSelected vo.k GET.borrow_status %} > {{ vo.v }}</option>
      {% endfor %}
      </select>
  </div>
  <div class="btn-group">
    <button type="button" class="btn btn-default" onclick="closeSearchDiv();">关闭</button>
    <button type="submit" class="btn btn-default">确定</button>
  </div>
</form>
</div>
<script>
function showSearchDiv(){
  $("div#search").show();
}
function closeSearchDiv(){
  $("div#search").hide();
}
</script>
{% endblock %}